<?php
// 连接数据库
include("./mysql-connect.php");
$data=$_POST['data'];
$datajson=(array)json_decode($data);
$username = $datajson["username"];
$password =$datajson["password"];
$tele=$datajson["tele"];
$email=$datajson["email"];
// INSERT INTO table_name ( field1, field2,...fieldN )VALUES ( value1, value2,...valueN );
$res = mysqli_query($con,"insert into user(username,password,tele,email) values('$username','$password','$tele','$email')");
$row = mysqli_fetch_assoc($res);
// echo $row;
$arr=[];
if($row){
    $arr = [
    "meta"=>[
        "status"=>0,
        "msg"=>"用户名已经存在"
    ]
];
}else{
    $arr = [
        "meta"=>[
            "status"=>1,
            "msg"=>"注册成功"
        ]
    ];

}
// echo $password;
echo json_encode($arr);